import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';

export const columns: BasicColumn[] = [
  // {
  //   title: '员工ID',
  //   dataIndex: 'employeeId',
  //   fixed: 'left',
  //   width: 100,

  // },
  {
    title: '姓名',
    dataIndex: 'name',
    width: 80,
  },
  {
    title: '性别',
    width: 40,
    dataIndex: 'sex',
    customRender: ({ text }) => {
      if (text === 0) {
        return '男';
      } else if (text == '1') {
        return '女';
      }
    },
  },
  {
    title: '员工编号',
    dataIndex: 'employeeNum',
    width: 50,
    // sorter: true,
    defaultHidden: false,
  },
  {
    title: '身份证号',
    dataIndex: 'certNo',
    width: 100,
    defaultHidden: false,
  },
  {
    title: 'email',
    dataIndex: 'email',
    width: 120,
  },
  {
    title: '联系电话',
    dataIndex: 'moblie',
    width: 80,
  },
  {
    title: '员工级别',
    width: 100,
    dataIndex: 'levelName',
    // filters: [
    //   { text: '基础员工级别', value: '基础员工级别' },
    //   { text: '集团专职型号总师', value: '集团专职型号总师' },
    // ],
  },
  {
    title: '扫码权限',
    width: 50,
    dataIndex: 'isQrCode',
    customRender: ({ text }) => {
      if (text === 1) {
        return '可扫码';
      } else {
        return '未分配';
      }
    },
    // filters: [
    //   { text: '基础员工级别', value: '基础员工级别' },
    //   { text: '集团专职型号总师', value: '集团专职型号总师' },
    // ],
  },
  {
    title: '是否同步',
    width: 50,
    dataIndex: 'isSync',
    customRender: ({ text }) => {
      if (text === 0) {
        return '未同步';
      } else if (text == '1') {
        return '已同步';
      }
    },
  },
  {
    title: '操作',
    dataIndex: 'action',
    width: 180,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: `employeeNum`,
    label: `员工编号`,
    component: 'Input',
    colProps: { span: 4 },
    componentProps: {
      placeholder: '职工编号',
      style: 'width: 120px',
      align: 'center',
    },
  },
  {
    field: `name`,
    label: `员工姓名`,
    component: 'Input',
    colProps: { span: 4 },
    componentProps: {
      placeholder: '员工姓名',
      style: 'width: 120px',
      align: 'center',
    },
  },
  {
    field: `moblie`,
    label: `联系方式`,
    component: 'Input',
    colProps: { span: 4 },
    componentProps: {
      placeholder: '联系方式',
      style: 'width: 120px',
      align: 'center',
    },
  },
  {
    field: `certNo`,
    label: `身份证号`,
    component: 'Input',
    colProps: { span: 12 },
    componentProps: {
      placeholder: '身份证号',
      style: 'width: 400px',
      align: 'center',
    },
  },
  {
    field: 'levelName',
    label: '员工级别',
    component: 'Select',
    colProps: { span: 12 },
    componentProps: {
      style: 'width: 400px',
      placeholder: '请选择员工级别',
      // style: 'width: 180px',
      options: [
        { label: '基础员工级别	', value: '基础员工级别	' },
        { label: '集团专职型号总师', value: '集团专职型号总师' },
        { label: '所领导', value: '所领导' },
        { label: '所长助理', value: '所长助理' },
        { label: '一级副总设计师', value: '一级副总设计师' },
        { label: '55周岁（含）以上二级副总设计师', value: '55周岁（含）以上二级副总设计师' },
      ],
    },
  },
];
export const accountFormSchema: FormSchema[] = [
  {
    field: 'employeeId',
    label: '员工ID',
    component: 'Input',
    show: false,
  },
  {
    field: 'levelName',
    label: '员工级别',
    // labelWidth: 200,
    component: 'Select',
    // required: true,
    defaultValue: '基础员工级别',
  },
  {
    field: 'employeeNum',
    label: '员工编号',
    component: 'Input',
    componentProps: {
      placeholder: '请根据实际情况进行员工编号配置',
    },
    required: true,
  },
  {
    field: 'name',
    label: '姓名',
    component: 'Input',
    componentProps: ({ formModel }) => {
      return {
        placeholder: '请输入员工姓名',
        onChange: (e: ChangeEvent) => {
          formModel.name = e.target.value;
        },
      };
    },

    required: true,
  },
  {
    field: 'sex',
    label: '性别',
    component: 'RadioGroup',
    componentProps: {
      options: [
        {
          label: '女',
          value: 1,
        },
        {
          label: '男',
          value: 0,
        },
      ],
    },
    required: true,
  },
  {
    field: 'email',
    label: '邮件地址',
    component: 'Input',
    rules: [
      {
        type: 'email',
        message: '请输入正确邮箱',
        trigger: 'blur',
      },
    ],
  },
  {
    label: '部门名称',
    field: 'deptName',
    component: 'Select',
    defaultValue: '所内差旅',
    componentProps: {
      placeholder: '请选择部门',
      options: [
        { label: '票务中心', value: '票务中心' },
        { label: '所内差旅', value: '所内差旅' },
      ],
    },
  },
  {
    field: 'moblie',
    label: '手机号 ',
    component: 'Input',
    rules: [
      {
        required: true,
        message: '手机号为必填项',
        trigger: 'blur',
      },
      {
        pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
        message: '请输入正确的手机号码',
        trigger: 'blur',
      },
    ],
  },
  {
    field: 'certNo',
    label: '证件号',
    component: 'Input',
    required: true,
  },
  {
    field: 'isSendLoginMsg',
    label: '是否发送登录帐号开通通知（短信、邮件）',
    defaultValue: 1,
    component: 'RadioGroup',
    // labelWidth: 260,
    ifShow: ({ values }) => {
      return values.isAllowLogin === 1;
    },
    componentProps: {
      options: [
        {
          label: '开通',
          value: 1,
        },
        {
          label: '不开通',
          value: 0,
        },
      ],
    },
  },
  {
    field: 'isQrCode',
    label: '审批单扫描',
    component: 'RadioGroup',
    // labelWidth: 260,
    defaultValue: 1,
    componentProps: {
      options: [
        {
          label: '具备',
          value: 1,
        },
        {
          label: '不具备',
          value: 0,
        },
      ],
    },
    required: true,
  },
  {
    field: 'isSync',
    label: '是否进行了同步',
    labelWidth: 260,
    component: 'RadioGroup',
    defaultValue: 0,
    ifShow: false,
    componentProps: {
      options: [
        {
          label: '已同步',
          value: 1,
        },
        {
          label: '未同步',
          value: 0,
        },
      ],
    },
  },
];
